package com.ksc.storekeeper.client.presenter;

import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.RequestTabsHandler;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.annotations.RequestTabs;
import com.gwtplatform.mvp.client.annotations.TabInfo;
import com.gwtplatform.mvp.client.proxy.RevealContentEvent;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;
import com.gwtplatform.mvp.client.proxy.TabContentProxy;
import com.ksc.storekeeper.client.mvp.NameTokens;
import com.ksc.storekeeper.client.mvp.StoreKeeperGinInjector;
import com.ksc.storekeeper.client.presenter.SettingsPresenter.SettingsPageProxy;
import com.ksc.storekeeper.client.view.SettingsView;

public class SettingsPresenter extends SubContainerPresenterBase<SettingsView, SettingsPageProxy> {

	@Inject
	public SettingsPresenter(EventBus eventBus, SettingsView view, SettingsPageProxy proxy) {
		super(eventBus, view, proxy, TYPE_SetTabContent, TYPE_RequestTabs);
	}

	@ProxyCodeSplit
	public interface SettingsPageProxy extends TabContentProxy<SettingsPresenter> {

	}

	@TabInfo(container = MainPagePresenter.class, priority = 2, nameToken = NameTokens.ADD_USER)
	static String getTabLabel(StoreKeeperGinInjector ginjector) {
		return ginjector.getStoreKeeperConstants().settings();
	}

	@Override
	protected void revealInParent() {
		RevealContentEvent.fire(this, MainPagePresenter.TYPE_SetMainContent, this);

	}

	@RequestTabs
	public static final Type<RequestTabsHandler> TYPE_RequestTabs = new Type<RequestTabsHandler>();

	@ContentSlot
	public static final Type<RevealContentHandler<?>> TYPE_SetTabContent = new Type<RevealContentHandler<?>>();
}
